package com.th.cash.th2.userliving

import com.th.basemodel.base.BaseRepository
import com.th.basemodel.bean.OkResult
import com.th.basemodel.ext.extRequestHttp
import com.th.basemodel.ext.extRequestHttp2
import com.th.cash.http.AppRetrofit
import com.th.cash.util.Constants
import okhttp3.MultipartBody

class UserLivingRepository : BaseRepository() {

    suspend fun initLiving(request: LivingInitRequest): OkResult<LivingInitResponse> {
        return extRequestHttp {
            AppRetrofit.userLivingService.initLiveness(request)
        }
    }

    suspend fun livingLimit(request: LivingLimitRequest): OkResult<Any> {
        return extRequestHttp {
            AppRetrofit.userLivingService.getLivenessLimit(request)
        }
    }

    suspend fun getLivingRid(request: LivingRidRequest): OkResult<LivingRidResponse> {
        return extRequestHttp {
            AppRetrofit.userLivingService.getLivingRid(request)
        }
    }

    suspend fun saveLiving(request: SaveLivingRequest): OkResult<SaveLivingResponse> {
        return extRequestHttp {
            AppRetrofit.userLivingService.saveLiveness(request)
        }
    }

    suspend fun uploadLiving(body: MultipartBody):OkResult<String>  {
        return extRequestHttp2<String> {
            AppRetrofit.userLivingService.livingUpload(Constants.LIVING_UPLOAD,body)
        }
    }
}